<?php
require_once './connect.php';
//{"doc_id":"","doc_name":"","dep_id":"","dep_name":""}
//获取数据库信息
/*$depidlist=array();
$depnamelist=array();*/
$datalist=array();
/*$sql = "SELECT dep_name FROM _department";
$result = $conn->query($sql);
if($result->num_rows>0){
    while($row=$result->fetch_assoc()){
        array_push($depnamelist,$row['doc_name']);
    }
}*/
$sql = "SELECT a.doc_id,a.doc_name,a.dep_id,b.dep_name FROM _doctor a INNER JOIN _department b ON a.dep_id=b.dep_id";
$resulttwo = $conn->query($sql);
if($resulttwo->num_rows>0){
    while($rowtwo=$resulttwo->fetch_assoc()){
        $datasingle=array('doc_id'=>$rowtwo['doc_id'],'doc_name'=>$rowtwo['doc_name'],
            'dep_id'=>$rowtwo['dep_id'],'dep_name'=>$rowtwo['dep_name']);
        array_push($datalist,$datasingle);
    }
}
$datalist=array('dataList' => $datalist);
$response=array(
    'resultCode'=>'0',
    'resultObject'=> $datalist,
    'resultMsg'=>'成功'
);
echo json_encode($response);
$conn->close();
?>